API - Cache\File_cache
system\cache.php at line 278

Class File_cache

Static_cache_driver
└─File_cache

public class File_cache
extends Static_cache_driver

A persistent cache using local file system tree. It does not use multilevel structure or lexicograph search, so it may slow down when your cache grows very big. But normally it is very fast reads.

Field Summary
private string

$dir

Cache root directory

Constructor Summary
File_cache

__construct(string dir)

Cache storage object constructor

Method Summary
void

clear(mixed realm)

bool

exists(string id, string realm, int ttl)

Checks if an object is stored in disk cache

mixed

get(string id, string realm, int ttl)

Gets an object directly from disk

void

remove(string id, string realm)

Removes cache image of the object from disk

bool

store(string id, mixed data, string realm)

Stores disk cache entry

Methods inherited from API - Cache\Static_cache_driver
store

Field Detail

system\cache.php at line 284

dir

private string $dir = 1
Cache root directory

Constructor Detail

system\cache.php at line 292

__construct

public File_cache __construct(string dir)
Cache storage object constructor
Parameters:
dir - Cache root directory. System default will be used if empty.
Throws:
Exception
Returns:

Method Detail

system\cache.php at line 312

clear

public void clear(mixed realm)
See Also:
Cache_driver::clear()

system\cache.php at line 356

exists

public bool exists(string id, string realm, int ttl)
Checks if an object is stored in disk cache
Parameters:
id - Object identifier
realm - Cache realm
ttl - Lifetime in seconds, 0 means unlimited
Returns:

system\cache.php at line 369

get

public mixed get(string id, string realm, int ttl)
Gets an object directly from disk
Parameters:
id - Object identifier
realm - Realm name
ttl - Lifetime in seconds, 0 means unlimited
Returns:
Cached item value or NULL if the item was not found in cache

system\cache.php at line 386

remove

public void remove(string id, string realm)
Removes cache image of the object from disk
Parameters:
id - Object identifier
realm - Realm name

system\cache.php at line 403

store

public bool store(string id, mixed data, string realm)
Stores disk cache entry
Parameters:
id - Object identifier
data - Object value
realm - Realm name
Returns: